package com.zego.wawaji.ui.store.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONObject;

/**
 * 商城商品
 * Created by Su on 2018/1/15.
 */
public class Store extends BaseData implements Parcelable {
    private int id;
    private String url;              // 商品介绍地址
    private String img;              // 展示图片地址
    private int wwCoinCz;            // 兑换金币数
    private String remark;           // title介绍
    private String title;           // title介绍

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);

        this.id = jsonObject.optInt("Id");
        this.url = jsonObject.optString("GoodsUrl");
        this.img = jsonObject.optString("GoodsImg");
        this.wwCoinCz = jsonObject.optInt("GoodsWwCoinCz");
        this.remark = jsonObject.optString("GoodsRemark");
        this.title = jsonObject.optString("GoodsTitle");
    }

    public String getTitle() {
        return title;
    }

    public int getId() {
        return id;
    }

    public String getUrl() {
        return url;
    }

    public String getImg() {
        return img;
    }

    public int getWwCoinCz() {
        return wwCoinCz;
    }

    public String getRemark() {
        return remark;
    }

    public Store() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.url);
        dest.writeString(this.img);
        dest.writeInt(this.wwCoinCz);
        dest.writeString(this.remark);
        dest.writeString(this.title);
    }

    protected Store(Parcel in) {
        this.id = in.readInt();
        this.url = in.readString();
        this.img = in.readString();
        this.wwCoinCz = in.readInt();
        this.remark = in.readString();
        this.title = in.readString();
    }

    public static final Creator<Store> CREATOR = new Creator<Store>() {
        @Override
        public Store createFromParcel(Parcel source) {
            return new Store(source);
        }

        @Override
        public Store[] newArray(int size) {
            return new Store[size];
        }
    };
}
